import request from "@/utils/http";

/*
params: {
  orderState:0,
  page:1,
  pageSize:2
}
*/

// 获取用户订单列表
export const getUserOrder = (params) => {
  return request({
    url: "/gscloud_order/p/myOrder/search_order",
    method: "GET",
    params,
  });
};

// 获取用户订单详情
export const getOrderDetailAPI = (params) => {
  return request({
    url: "/gscloud_order/p/myOrder/order_detail",
    method: "GET",
    params,
  });
};

// 结算，生成订单信息
export const getCheckInfoAPI = (data) => {
  return request({
    url: "/gscloud_order/a/order/confirm",
    method: "POST",
    data,
  });
};

// 支付成功更新订单状态
export const orderPayInfoAPI = (orderId) => {
  return request({
    url: "/gscloud_order/a/order/paySuccessUpdateOrderStatus/" + orderId,
    method: "POST",
  });
};

// 提交订单，返回支付流水号
export const submitOrderAPI = (data) => {
  return request({
    url: "/gscloud_order/a/order/submit",
    method: "POST",
    data,
  });
};

// 根据订单号取消订单
export const cancelOrderAPI = (params) => {
  return request({
    url: "/gscloud_order/p/myOrder/cancel/" + params,
    method: "PUT",
  });
};

//用户评论
export const spuEvaluationAPI = (data) => {
  return request({
    url: "/gscloud_product/app/spuEvaluation/save",
    method: "POST",
    data,
  });
};
